Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Determine  Which  Account  a  Script  is  Running  Under  

 Content of Determine Which Account a Script is Running Under.vbs
MD5 Hash: 2E4E5E6860517DFBC13C009688527654
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where " & _
"Name = 'cscript.exe' or Name = 'wscript.exe'")

For Each objProcess in colProcessList
If InStr(objProcess.CommandLine, "test.vbs") Then
colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain)
Wscript.Echo "This script is running under the account belonging to " _
& strUserDomain & "\" & strNameOfUser & "."
End If
Next



   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a